package lambda;

import java.util.Comparator;

/**
 * @Author Klys
 * @Date 2023/3/5 9:52
 * @Description
 * @Version 1.0
 */
public class demo1 {
    public static void main(String[] args) {
        // 根据字符串长度比较大小
        Comparator<String> comparator = (s1, s2) -> s1.length() - s2.length();
        int compare = comparator.compare("abc", "ab");
        System.out.println(compare);

    }
}
